<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>查找a的个数</title>
		<script>
			var ar=new Array("sdfsdf","aaasdfe","fsdfasdf","china");
			var count=0;
			for(var i=0;i<ar.length;i++)
			{
				var str=ar[i];
				var from=-1;
				for(var j=0;j<str.length;j++)
				{
					from=str.indexOf("a",from+1);
					console.log(str+","+from);
					if(from>=0)
						count++;
					else
						break;
				}
			}
			alert(count);
		</script>
	</head>
	<body>
	</body>
</html>
